/*
 * HashTableTest.cpp
 *
 *  Created on: Nov 3, 2013
 *      Author: SG0214746
 */

#include "HashTableTest.h"
#include "../persistence/hash/HashTable.h"
#include <iostream>

HashTableTest::HashTableTest() {}

HashTableTest::~HashTableTest() {}

void HashTableTest::run() const {
	std::cout << "test de la tabla hash" << std::endl;
	duplicateTest();
	std::cout << std::endl;
	circularSetTest();
}

void HashTableTest::duplicateTest() const {
	std::cout << "duplicado de la tabla, valores espejados" << std::endl;
	HashTable table;
	std::cout << table.toString() << std::endl;
	table.duplicate();
	std::cout << table.toString() << std::endl;
	table.set(1, 1, 1);
	table.duplicate();
	std::cout << table.toString() << std::endl;
	table.set(2, 2, 2);
	table.set(3, 3, 3);
	table.duplicate();
	std::cout << table.toString() << std::endl;
}

void HashTableTest::circularSetTest() const {
	std::cout << "escritura circular en tabla de tamanio 8, desde pos 2 saltos de 4" << std::endl;
	HashTable table;
	table.duplicate();
	table.duplicate();
	table.duplicate();
	std::cout << table.toString() << std::endl;
	table.setCircular(2, 4, 1);
	std::cout << table.toString() << std::endl;
}
